<template>
	<view class="content">
		<view class="cons">
			<view class="list" v-for="(item, index) in arrList" :key="index" @click="goQuan(item.coupons.price,item.id)">
				<image v-if="item.status == 1" class="list_bg" src="../../static/img/quanbg.png"></image>
				<image v-if="item.status == 2" class="list_bg" src="../../static/img/yi_bg.png"></image>
				<view class="lista flexs1">
					<view class="list_left flexs2">
						<text class="text-red bigs1">￥</text>
						<text class="text-red bigs">{{item.coupons.price}}</text>
						<text class="small">{{item.coupons.name}}</text>
					</view>
					<view class="list_right flexs2">
						<view class="quans">
							<image v-if="item.status == 1" class="quan_img" src="../../static/img/shiyong.png"></image>
							<image v-if="item.status == 2" class="quan_img" src="../../static/img/yiyong.png"></image>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				arrList:[],
				status:'',
				
			}
		},
		onLoad(option) {
			if(option.status){
				this.status = option.status;
			}
		},
		onShow(){
			this.initData();
		},
		methods: {
			//初始化数据
			initData(){
				var obj = {
					status : this.status
				}
				this.$common.requests('/api/shop/mycoupons', obj).then(res => {
					if (res.data.code == 1) {
						this.arrList = res.data.data;
					}
				})
			},
			//选择
			goQuan(price,id){
				var pages = getCurrentPages();
				var currPage = pages[pages.length - 1]; //当前页面
				var prevPage = pages[pages.length - 2]; //上一个页面  
				prevPage.$vm.quanP = price; 
				prevPage.$vm.id = id; 
				// uni.
				uni.navigateBack({
					delta:1
				})
			},
		},
	
	}
</script>
	
<style>
	.content{
		width: 100%;
		height: 100vh;
		background: #F9F9F9;
	}
	.cons{
		padding: 30upx 50upx;
	}
	.list{
		width: 100%;
		height: 200upx;
		position: relative;
		top: 0;
		left: 0;
		margin-bottom: 30upx;
	}
	.list_bg{
		width: 100%;
		height: 100%;
	}
	.lista{
		width: 100%;
		height: 100%;
		position: absolute;
		top: 0;
		left: 0;
	}
	.list_left{
		width: 74%;
		height: 100%;
		padding-bottom: 20upx;
	}
	.list_right{
		width: 26%;
		height: 100%;
	}
	.quans{
		width: 65%;
		padding-bottom: 65%;
		position: relative;
		top: 0;
		left: 0;
	}
	.quans image{
		width: 100%;
		height: 100%;
		position: absolute;
		top: 0;
		left: 0;
	}
	.bigs1{
		font-size: 40upx;
	}
	.bigs{
		font-size: 100upx;
		padding: 0 5upx;
	}
	.small{
		font-size: 30upx;
	}
</style>
